// pages/admin/admin.js
var app = getApp();
var util = require("../../utils/libs.js")
var api = require("../../utils/api.js")
Page({
  data: {
    tabs: [{ fun: "indexTo", menus: '首页', url: '../../imgs/index/index_c.png', icon: 'indexI', active: '' }, { fun: "publishTo", icon: "centerI", menus: '发布', url: '../../imgs/index/center_c.png', active: '' }, { fun: "adminTo", menus: '我的', url: '../../imgs/index/admin.png', icon: 'lastI', active: 'active' }],
    avatar:{

    },
    menus:[{
      icon:'../../imgs/edit_i.png',
      title:'我的发布',
      url:'../publish/publish',
      cls:''
    },{
        icon: '../../imgs/mess_i.png',
        title: '我的回复',
        url:'../reply/reply',
        cls:''
      },{
        icon: '../../imgs/in_i.png',
        title: '我收到的邀请',
        url:'../commonlist/commonlist',
        cls:''
    },{
      icon: '../../imgs/fa_i.png',
      title: '我的收藏',
      url:'../collection/collection',
      cls:'mr20'
      }, {
        icon: '../../imgs/me_i.png',
        title: '我的消息',
        url:'../message/message',
        cls:''
      }
    ],
    imgActive:'item-img',
    id:null,
    bgImg:'item-imgs',
    textColor:'text',
    fontColor:'text',
    Color:'text',
    uid:null
  },
  
  onLoad(options) {
    let that = this;
  that.getUserInfo()
    // 页面初始化 options为页面跳转所带来的参数
  },
  getUserInfo(){
    let that =this
    var id = wx.getStorageSync('uid')
    that.setData({
      uid:id
    })
    util.request(api.userInfo,{uid:id},"GET")
    .then(function (res) {
      if(res.error_code === 0){
        that.setData({
          avatar:res.data.user
        })
      }
    })
  }, 
  onReady() {
    // 页面渲染完成
  },
  onShow() {
    // 页面显示
  },
  go:function(event){
    let that = this
    var urls = event.currentTarget.dataset.url;
    wx.navigateTo({
      url: urls+"?id="+that.data.id
    })
    // 页面隐藏
  },
  handleSubmit () {
    wx.navigateTo({
      url: "/pages/account/account"
    })
  },
  onUnload() {
    // 页面关闭
  }
})
